package io.qytc.jboot.service.provider.impl;

import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Page;
import io.jboot.aop.annotation.Bean;
import io.jboot.components.rpc.annotation.RPCBean;
import io.jboot.db.model.Columns;
import io.qytc.jboot.service.api.VersionInfoService;
import io.qytc.jboot.service.entity.model.VersionInfo;
import io.jboot.service.JbootServiceBase;


@Bean
@RPCBean
public class VersionInfoServiceImpl extends JbootServiceBase<VersionInfo> implements VersionInfoService {

    @Override
    public Page<VersionInfo> findPage(VersionInfo search, int pageNumber, int pageSize) {
        Columns columns = Columns.create();

        if (StrKit.notBlank(search.getName())) {
            columns.like("name", "%"+search.getName()+"%");
        }

        return DAO.paginateByColumns(pageNumber, pageSize, columns.getList(), "id asc");
    }
}